cmake_minimum_required(VERSION 3.10)

# 
project(RC_upper VERSION 1.0 LANGUAGES CXX)

# 
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_C_FLAGS_RELEASE "-O3")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

# 找到 Qt6 并指定需要的模块
find_package(Qt6 REQUIRED COMPONENTS 
    Core 
    Widgets
    PrintSupport
)

# 包含 Qt 的头文件目录
include_directories(${Qt6_INCLUDE_DIRS})

# openMP settings
FIND_PACKAGE(OpenMP REQUIRED)
if (OPENMP_FOUND)
    message("OPENMP FOUND")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif ()

# Eigen
find_package(Eigen3 REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIRS})

# OPENBLAS
find_package(OpenBLAS REQUIRED)
include_directories(${OpenBLAS_INCLUDE_DIRS})

# ====================可执行文件====================
include_directories(
    ./include
    ../communicate
    ../dependency/cpp_tools
)

# 
file(GLOB CORE_SOURCES 
    src/*.cpp
)
message(============upper: ${CORE_SOURCES})
add_executable(upper
    ${CORE_SOURCES})
target_link_libraries(upper 
    ${OpenBLAS_LIBRARIES} 
    tinyxml2
    Qt6::Core 
    Qt6::Widgets
    Qt6::PrintSupport
    qcustomplot
)